<template>
  <!-- 处理布局组件结构样式和导航 -->
  <div class="container">
    <!-- 头 -->
    <van-nav-bar
      v-if="$route.path !== '/user'"
      fixed
      @click="$router.back()"
      right-text="搜索"
      @click-right="$router.push('/search')"
      title="首页"
    ></van-nav-bar>
    <!-- 二级挂载点 -->
    <div class="my-wrapper" :class="{ noTop: $route.path === '/uesr' }">
      <router-view></router-view>
    </div>
    <!-- 菜单 -->
    <van-tabbar route>
      <van-tabbar-item to="/" icon="home-o">首页</van-tabbar-item>
      <van-tabbar-item to="/question" icon="search">问答</van-tabbar-item>
      <van-tabbar-item to="/video" icon="friends-o">视频</van-tabbar-item>
      <van-tabbar-item to="/user" icon="setting-o">我的</van-tabbar-item>
    </van-tabbar>
  </div>
</template>
<script>

export default ({
  created () {
    console.log('获取当前页面的path路径:', this.$route)
  }
})
</script>
<style scoped lang='less'>
.container {
  width: 100%;
  height: 100%;
  position: relative;
  .my-wrapper {
    width: 100%;
    height: 100%;
    overflow: hidden;
    padding-top: 46px;
    padding-bottom: 50px;
    box-sizing: border-box;
    &.noTop {
      padding-top: 0;
    }
  }
}
</style>
